#!/usr/bin/env python
"""
This script compares xml files
"""

from standard_script_setup import *
from CIME.case import Case

def parse_command_line(args, description):
    parser = argparse.ArgumentParser(
        usage="""\n{0} [--verbose]
OR
{0} --help

\033[1mEXAMPLES:\033[0m
    \033[1;32m# check_lockedfiles SMS\033[0m
    > {0}
""".format(os.path.basename(args[0])),

        description=description,

        formatter_class=argparse.ArgumentDefaultsHelpFormatter
    )

    CIME.utils.setup_standard_logging_options(parser)

    parser.add_argument("--caseroot", default=os.getcwd(),
                        help="Case directory to build")

    args = CIME.utils.parse_args_and_handle_standard_logging_options(args, parser)

    return args.caseroot

def _main_func(description):
    caseroot = parse_command_line(sys.argv, description)

    with Case(case_root=caseroot, read_only=True) as case:
        case.check_lockedfiles()

if __name__ == "__main__":
    _main_func(__doc__)
